home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_10_04
/
1004093a
< prev
next >
Wrap
Text File
|
1992-02-08
|
355b
|
27 lines
#include <stdio.h>
#define STACK_SIZE 10
static node stack[STACK_SIZE];
static size_t stack_ptr = 0;
void push(node n)
{
if (stack_ptr == STACK_SIZE)
printf("Stack is full\n");
else
stack[stack_ptr++] = n;
}
node pop(void)
{
static node error_node = {Error, 0};
if (stack_ptr == 0)
return error_node;
else
return stack[--stack_ptr];
}